<?php
 include "counter.php";
?>
<?php pagehead("Times of last login") ?>
<BODY bgcolor="white">
<?php pagetop("Times of last login") ?>
The counter times out entries if they have not been accessed for two
 years, or after one year if the email goes bad.
<p>
<?php
	$lastworthbothering = strftime("%Y-%m-01 00:00:00",
				time() - 60*60*24*30*10); # 10 months
?>
This table gives the age of entries currently in the database and in
 states "OK" or "Bad" and ages older than <?php echo
 $lastworthbothering ?>.

<table border>
<?php
        
	$sql = "select substring(logintime, 1, 7) as m,
	     count(*) from users where (users.state = 'ok' or
	     users.state = 'bad') and logintime < '$lastworthbothering'
	     group by m";

        $placeq = mysql_query($sql);
        while ( $place = mysql_fetch_array($placeq)) {
	    print("<tr><td>" . $place[0] . "<td>" . $place[1] . "\n");
        }

?>
</table>

<?php pagebottom() ?>
</body>
</html>


